<HTML>
<HEAD>
<TITLE>
Cubo.cpp
</TITLE>
</HEAD>
<BODY>
<PRE>
<font color="blue">#include</font> <font color="maroon">"Cubo.h"</font>

Cubo<font color="black">:</font><font color="black">:</font>Cubo<font color="black">(</font><font color="blue">unsigned</font> <font color="blue">int</font> numero, <font color="blue">unsigned</font> <font color="blue">int</font> td<font color="black">)</font><font color="black">{</font>
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>numero<font color="black">=</font>numero;
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>td<font color="black">=</font>td;
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>claves<font color="black">=</font><font color="blue">new</font> vector<font color="black">&#60;</font><font color="blue">unsigned</font> <font color="blue">long</font> <font color="blue">int</font><font color="black">&#62;</font><font color="black">(</font><font color="black">)</font>;
<font color="black">}</font>

Cubo<font color="black">:</font><font color="black">:</font>~Cubo<font color="black">(</font><font color="black">)</font><font color="black">{</font>
    <font color="blue">delete</font> <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>claves;
<font color="black">}</font>

<font color="blue">void</font> Cubo<font color="black">:</font><font color="black">:</font>InsertarClave<font color="black">(</font><font color="blue">unsigned</font> <font color="blue">long</font> <font color="blue">int</font> claveAInsertar<font color="black">)</font><font color="black">{</font>
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>claves<font color="black">-</font><font color="black">&#62;</font>push_back<font color="black">(</font>claveAInsertar<font color="black">)</font>;
<font color="black">}</font>

<font color="blue">void</font> Cubo<font color="black">:</font><font color="black">:</font>EliminarClave<font color="black">(</font><font color="blue">unsigned</font> <font color="blue">long</font> <font color="blue">int</font> claveAEliminar<font color="black">)</font><font color="black">{</font>
    <font color="blue">unsigned</font> <font color="blue">int</font> i<font color="black">=</font><font color="maroon">0</font>;
    <font color="blue">bool</font> encontrado<font color="black">=</font><font color="blue">false</font>;
    <font color="blue">while</font> <font color="black">(</font><font color="black">(</font>i<font color="black">&#60;</font><font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>claves<font color="black">-</font><font color="black">&#62;</font>size<font color="black">(</font><font color="black">)</font><font color="black">)</font> <font color="black">&</font><font color="black">&</font> <font color="black">(</font><font color="black">!</font>encontrado<font color="black">)</font><font color="black">)</font><font color="black">{</font>
        <font color="blue">if</font> <font color="black">(</font>claveAEliminar<font color="black">=</font><font color="black">=</font><font color="black">*</font><font color="black">(</font><font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>claves<font color="black">-</font><font color="black">&#62;</font>begin<font color="black">(</font><font color="black">)</font><font color="black">+</font>i<font color="black">)</font><font color="black">)</font><font color="black">{</font>
            <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>claves<font color="black">-</font><font color="black">&#62;</font>erase<font color="black">(</font><font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>claves<font color="black">-</font><font color="black">&#62;</font>begin<font color="black">(</font><font color="black">)</font><font color="black">+</font>i<font color="black">)</font>;
            encontrado<font color="black">=</font><font color="blue">true</font>;
        <font color="black">}</font><font color="blue">else</font><font color="black">{</font>
            i<font color="black">+</font><font color="black">+</font>;
        <font color="black">}</font>
    <font color="black">}</font>   
<font color="black">}</font>

<font color="blue">bool</font> Cubo<font color="black">:</font><font color="black">:</font>estaVacio<font color="black">(</font><font color="black">)</font><font color="black">{</font>
    <font color="blue">return</font> <font color="black">(</font><font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>claves<font color="black">-</font><font color="black">&#62;</font>empty<font color="black">(</font><font color="black">)</font><font color="black">)</font>;
<font color="black">}</font>

<font color="blue">void</font> Cubo<font color="black">:</font><font color="black">:</font>setTd<font color="black">(</font><font color="blue">unsigned</font> <font color="blue">int</font> tamanio<font color="black">)</font><font color="black">{</font>
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>td<font color="black">=</font>tamanio;
<font color="black">}</font>

<font color="blue">unsigned</font> <font color="blue">int</font> Cubo<font color="black">:</font><font color="black">:</font>getTd<font color="black">(</font><font color="black">)</font><font color="black">{</font>
    <font color="blue">return</font> <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>td;
<font color="black">}</font>

std<font color="black">:</font><font color="black">:</font>vector<font color="black">&#60;</font><font color="blue">unsigned</font> <font color="blue">long</font> <font color="blue">int</font><font color="black">&#62;</font><font color="black">*</font> Cubo<font color="black">:</font><font color="black">:</font>getClaves<font color="black">(</font><font color="black">)</font><font color="black">{</font>
    <font color="blue">return</font> <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>claves;
<font color="black">}</font>

</PRE>
</BODY>
</HTML>
